1: | rev1(0,nil) | → 0 | |
2: | rev1(s(X),nil) | → s(X) | |
3: | rev1(X,cons(Y,L)) | → rev1(Y,L) | |
4: | rev(nil) | → nil | |
5: | rev(cons(X,L)) | → cons(rev1(X,L),rev2(X,L)) | |
6: | rev2(X,nil) | → nil | |
7: | rev2(X,cons(Y,L)) | → rev(cons(X,rev(rev2(Y,L)))) | |
8: | REV1(X,cons(Y,L)) | → REV1(Y,L) | |
9: | REV(cons(X,L)) | → REV1(X,L) | |
10: | REV(cons(X,L)) | → REV2(X,L) | |
11: | REV2(X,cons(Y,L)) | → REV(cons(X,rev(rev2(Y,L)))) | |
12: | REV2(X,cons(Y,L)) | → REV(rev2(Y,L)) | |
13: | REV2(X,cons(Y,L)) | → REV2(Y,L) | |